<tagLib name="html" />
<include file="__THEME__/header" />
<link href="../Public/css/space.css" rel="stylesheet" type="text/css" />
<div class="contents lbg B">
  <!--左边信息 begin-->
  	<include file="../Public/home_left" />

  <!--中间信息 begin--->
  <div class="contents_min w787">
                    <h3 class="tit_h3">基本资料</h3>
                      <p class="pt10 f12 cl03 mb20 pl5"><img class="alM pr5" src="../Public/images/title_icon_17.gif" />个人空间基本信息设置，完善你的资料，让更多人了解你，展示你的更多信息。</p>
                   	  <div class="list_cate_nav mt10 mb20">
                      <div class="tab">
                       	<ul>
                       	<volist id="vo" name="topmenu">
                       		<php>$class=($type==$key)?'class="sam_status on"':''</php>
                       		<li {$class}><span><a href="{$vo.url}" >{$vo.info}</a></span>{:$_GET['act']}</li>
                       	</volist>
                        </ul>
                        </div>
                      </div>
                        <div class="C"></div>
                        <div>
<form action="" method="post" id="baseinfo_form" autocomplete="off" onsubmit="return checkform()">   
<input type="hidden" name="uid" value="{$uid}" />                     
                      	<table width="98%" align="left">
<volist id="vo" name="list">
	<php>if($isHrbi){</php>
		                   	  <tr height="35">
		                            <td align="right">{$vo.info}：</td>
		                            <td align="left" ><span id="have_edit_{$vo.field}">{$vo.value}</span> <input class="in_put" name="data[{$vo.field}]" type="hidden"  value="{$vo.value}" /></td>
		                            <td align="left">
		                            <php>if($vo['need']){</php>	
		                            	<input type="checkbox" name="index[]" checked disabled value="{$vo.field}" />空间显示	
									<php>}else{</php>
										<input type="checkbox" name="index[]" <php>if(in_array($vo['field'],$space)){</php>checked<php>}</php>  value="{$vo.field}" />空间显示
									<php>}</php>									
									</td>
		                      </tr>
    <php>}else{</php>
		                   	  <tr height="35">
		                            <td align="right" width="20%">{$vo.info}：</td>
		                            <td align="left" width="45%">
			<switch name="vo['field']">
				<case value="cardId|shortname">
					{$vo.value}<input type="hidden" name="data[{$vo.field}]" class="in_put" value="{$vo.value}" />
				</case>				
				<case value="usersex">
					<php>$options = array('GG'=>'GG','MM'=>'MM');$usersex=$vo['value']</php>							
					<html:select name="data[usersex]" options='{options}' selected='{usersex}' />							
				</case>
				<default/><input type="text" name="data[{$vo.field}]" class="in_put" value="{$vo.value|htmlspecialchars}" maxlength="40" />
			</switch>
		                            </td>
		                            <td align="left" width="40%">
		                            <php>if($vo['need']){</php>	
		                            	<input type="checkbox" name="index[]" checked disabled value="{$vo.field}" />空间显示	
									<php>}else{</php>
										<input type="checkbox" name="index[]" <php>if(in_array($vo['field'],$space)){</php>checked<php>}</php>  value="{$vo.field}" />空间显示
									<php>}</php>		</td>
		                      </tr>
    <php>}</php>
</volist>
                             </tr>
                               <tr height="50">
                            	<td align="right"></td>
                                <td align="left"><input class="btn_sea" name="" type="submit" value="保存修改" />&nbsp;&nbsp;&nbsp;&nbsp; <php>if($isHrbi){</php><input class="btn_sea" name="" id="updatahandle"  type="button" onclick="getHrbiInfo('{$cardId}')" value="同步数据" /> <php>}</php></td>
<td align="left" id="baseinfomessage"></td>                                
                                
                            </tr>
                        </table>
</form>                        
                        </div>
                </div>
  
  <!--中间信息 begin--->
  <div class="C"></div>
</div>

<php>if($isHrbi){</php>
	<script>
	//提取用户最新的HRBI资料
	function getHrbiInfo(cardId){
		var ob = '';
		var oe = '';
		var newn = 0;
		$('#updatahandle').val('数据同步中...');
		$.getJSON("{:U('home/Info/getHrbiInfo')}",{cardId:cardId},function(data){
			$.each(data,function(i,item){
				ob = $("#baseinfo_form [name='data["+item.field+"]']");			
				if(ob.val()!=item.value){
					ob.removeAttr('readonly');
					ob.val(item.value);
					$("#have_edit_"+item.field).css('border','1px solid red');
					$("#have_edit_"+item.field).html(item.value);
					newn++;
				}
			});
			if(newn==0){
				$('#updatahandle').val('信息已是最新！');
			}else{
				$('#updatahandle').val('同步完成，请保存');
			}
		})
	}
	</script>
<php>}else{</php>
<script>
	function checkform(){
		var username   = $.trim($("#baseinfo_form [name='data[username]']").val());
		var department = $.trim($("#baseinfo_form [name='data[department]']").val());
		var englishname = $.trim($("#baseinfo_form [name='data[englishname]']").val());
		if(!username){
			$.tbox.no('请填写您的真实姓名','操作失败');
			$("#baseinfo_form [name='data[username]']").focus();
			return false;
		}
		if(username.length >=16){
			$.tbox.no('您输入的真实姓名过长','操作失败');
			$("#baseinfo_form [name='data[username]']").focus();
			return false;
		}		
		if(!department){
			$.tbox.no('请填写您所在的部门','操作失败');
			$("#baseinfo_form [name='data[department]']").focus();
			return false;
		}
		if(!englishname){
			$.tbox.no('请填写您的英文名称','操作失败');
			$("#baseinfo_form [name='data[englishname]']").focus();
			return false;
		}
		return true;
	}
</script>
<php>}</php>

<include file="__THEME__/footer" />